package com.pucheng.bracelet.viewmodel.heartrate

import androidx.lifecycle.*
import com.pucheng.bracelet.app.database.repository.AllDataHRRepository
import com.pucheng.bracelet.app.database.repository.DBRepository
import com.pucheng.bracelet.app.util.CacheUtil
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import com.pucheng.bracelet.app.util.DatetimeUtil
import com.pucheng.bracelet.data.bean.AllHertRateBean
import com.pucheng.bracelet.data.bean.StepsBean

class AllDayHRToDayViewModel : BaseViewModel() {

    private val repository: AllDataHRRepository = AllDataHRRepository()
    public var queryDate = MutableLiveData<String>().apply {
        value = "2021-06-14"
    }

    var hertRateData = MutableLiveData<AllHertRateBean>().apply {
        value = AllHertRateBean(DatetimeUtil.getNowDate(DatetimeUtil.DATE_PATTERN_A_H))
    }

    fun queryDateToDate(){
        hertRateData .value =  repository.getHertratesInfoToDate(queryDate.value!!).value
    }
}

